/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package game.jetclan.niftygui;

/**
 *
 * @author cla_marwas
 */
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.niftygui.NiftyJmeDisplay;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.screen.Screen;
import de.lessvoid.nifty.screen.ScreenController;

public class NiftyGuiMain extends SimpleApplication implements ScreenController {

    private Nifty nifty;

    public static void main(String[] args) {
        NiftyGuiMain app = new NiftyGuiMain();
        app.setPauseOnLostFocus(false);
        app.start();
    }

    public void simpleInitApp() {
        Box b = new Box(Vector3f.ZERO, 1, 1, 1);
        Geometry geom = new Geometry("Box", b);
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setTexture("ColorMap", assetManager.loadTexture("Interface/nifty-logo.png"));
        geom.setMaterial(mat);
        rootNode.attachChild(geom);
        NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort);
        nifty = niftyDisplay.getNifty();
        nifty.fromXml("Interface/hud.xml", "start", this);
        //nifty.fromXml("Interface/NiftyDefinition.xml", "start", this);          // attach the nifty display to the gui view port as a processor         
        //nifty.fromXml("Interface/newconsole.xml", "start", this);          // attach the nifty display to the gui view port as a processor         
        guiViewPort.addProcessor(niftyDisplay);          // disable the fly cam //        
        flyCam.setEnabled(false); //        
        flyCam.setDragToRotate(true);
        inputManager.setCursorVisible(true);
    }

    public void bind(Nifty nifty, Screen screen) {
        System.out.println("bind( " + screen.getScreenId() + ")");
    }

    public void onStartScreen() {
        System.out.println("onStartScreen");
    }

    
    public void onEndScreen() {
        System.out.println("onEndScreen");
    }

    public void quitGame() {
        System.out.println("Quit FOOL");
    }

     public void test() {
        System.out.println("TEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEST");
    }

    
    public void quit() {
        nifty.gotoScreen("end");
    }
    
    public void goToCharacterScreen(){
        nifty.gotoScreen("create_character_screen");
    }
    
    public void goToMainMenu(){
        nifty.gotoScreen("start");
    }
    
}
